<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"> 
    <!--
    Author mingzhou
    -->
    <h:head> 
        <title>SABM</title> 

        <style type="text/css"> 

            .gritter-notice-wrapper { 
                left:200px; 
                top:50px; 
            }
        </style> 

    </h:head> 
    <h:body>     
        <ez:RepHeaderMenu/>
        <h1>Stakeholder Account and Billing Management(SABM)- Representative Portal</h1> 

        <p:layout style="table-layout:auto; height:600px ">

            <p:layoutUnit position="left" header="Navigation" width="300">
                <ez:RepSABMLeftMenu/>
            </p:layoutUnit>

            <p:layoutUnit position="center" header="Settings" scrollable="true">



                <h:outputText style="font-weight: bold" value="Add new Advertisement: "/>

                <h:form>


                    <h:panelGrid   columns="3" style="text-align: left">

                        <h:outputLabel for="URL" value="URL: "/>
                        <p:inputText id="URL" value="#{advertisementMB.link}" required="true"
                                     requiredMessage="Ads URL required!"/>
                        <br/>

                        <h:outputLabel for="effectiveStart" value="Effective Start Date: "/>
                        <p:calendar id="effectiveStart" value="#{advertisementMB.startDate}"
                                    pattern="dd MMM, yyyy (EEE)" required="true" requiredMessage="Start Date is required"/>
                        <br/>


                        <h:outputLabel for="effectiveEnd" value="Effective End Date: "/>
                        <p:calendar id="effectiveEnd" value="#{advertisementMB.endDate}"
                                    pattern="dd MMM, yyyy (EEE)" required="true" requiredMessage="End Date is required"/>
                        <br/>

                        <h:outputLabel for="Keywords" value="Keywords: "/>
                        <p:inputText id="Keywords" value="#{advertisementMB.tags}" required="true"
                                     requiredMessage="Keywords required!"/>
                        <br/>
                        <h:outputLabel for="Price" value="Place Max Bidding Price: "/>
                        <p:inputText id="Price" value="#{advertisementMB.biddingPrice}" required="true"
                                     requiredMessage="BiddingPrice required!"/>
                        <br/>
                        <h:outputText value="Subscription: "/>
                        <h:selectBooleanCheckbox value="#{advertisementMB.isSubscription}"/><br/>
                        <br/>
                        <h:outputText value="Impression: "/>
                        <h:selectBooleanCheckbox value="#{advertisementMB.isImpression}"/><br/>
                        <br/>
                        <h:outputText value="Upload Image: "/>
                        <h:form enctype="multipart/form-data" prependId="false">
                            <p:growl id="growl2" showDetail="true" life="2000"></p:growl> 
                            <p:fileUpload fileUploadListener="#{photoManagedBean.handleAdvertisementPhotoUpload}" multiple="false" label="Browse" auto="true" allowTypes="*.jpg;*.png;*.gif;" description="Images" update="pic" />
                        </h:form><br/>
                        <h:outputLabel for="pic" value="Preview Image: "/> 
                        <p:graphicImage id="pic" value="#{photoManagedBean.dishFilePath}" height="100"
                                        width="100"/><br/><br/>

                        <h:outputLabel for="description" value="Description: "/> 
                        <p:inputTextarea id="description" 
                                         value="#{advertisementMB.description}" 
                                         required="true" requiredMessage="Description needed!"
                                         style="width:500px; height:200px"/>


                    </h:panelGrid>

                    <p:commandButton id="newAdvertisement" value="Submit new Ads" ajax="false"
                                     actionListener="#{advertisementMB.addNewAdvertisement}"
                                     update="display" />


                </h:form>

            </p:layoutUnit>
        </p:layout>



    </h:body> 
</html>